home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Dialectic 1.2 / source / Dialectic ƒ / Shell ƒ / util.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  962 b   |  37 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        util.c
  4.  
  5. Purpose:    This module handles standard memory copying and comparing.
  6.  
  7. \**********************************************************************/
  8.  
  9. #include "util.h"
  10.  
  11. void Mymemcpy(Ptr output, Ptr input, unsigned long len)
  12. /* like unix memcpy -- output first, then input, then length */
  13. {
  14.     BlockMove(input, output, len);
  15. }
  16.  
  17. void Mymemset(Ptr output, unsigned char value, unsigned long len)
  18. /* Good for zeroing sensitive data.  Not that I have anything sensitive, of course ;) */
  19. {
  20.     unsigned long    i;
  21.     
  22.     for (i=0; i<len; i++)
  23.         *((unsigned char*)((long)output+i))=value;
  24. }
  25.  
  26. Boolean Mymemcompare(Ptr thisThing, Ptr thatThing, unsigned char len)
  27. /* standard memory compare, byte for byte */
  28. {
  29.     unsigned char    i;
  30.     Boolean            goon;
  31.     
  32.     goon=TRUE;
  33.     for (i=0; (i<len) && (goon); i++)
  34.         goon=(*((unsigned char*)((long)thisThing+i))==*((unsigned char*)((long)thatThing+i)));
  35.     return goon;
  36. }
  37.